package controller

import (
	"demo_test/webservice_demo/module"
	"demo_test/webservice_demo/util"
	"github.com/julienschmidt/httprouter"
	"net/http"
)

func AddUser(w http.ResponseWriter, r *http.Request, param httprouter.Params) {

	params := util.DecodeParams(r)

	user := module.User{UserName: params["username"], Pwd: params["pwd"]}

	err := user.AddUser()
	if err != nil {
		util.FailRender(w, err.Error())
	}

	util.SuccessRender(w, "添加成功")

}
